import { routerMiddleware } from 'connected-react-router'
import { createBrowserHistory } from 'history'
import { applyMiddleware,  createStore } from 'redux'
import rootReducer from './reducers'
import createSagaMiddleware from 'redux-saga'
import rootSaga from './sagas/rootSage'
import {composeWithDevTools} from 'redux-devtools-extension'

export const history = createBrowserHistory()
const sagaMiddleware = createSagaMiddleware()

const rootStore = createStore(
    rootReducer(history),
    composeWithDevTools(applyMiddleware(routerMiddleware(history), sagaMiddleware)
    ))
sagaMiddleware.run(rootSaga)
export default rootStore